<template>
  <a-modal
    class="hmodal"
    v-model="show"
    v-bind="config"
    :closable="false"
    @cancel="cancel"
    :footer="null">
    <div class="h-modal-head">
      {{ title }}
    </div>
    <div class="h-modal-card">
      <div class="h-modal-card-cnt">
        <slot></slot>
      </div>
      <div class="h-modal-footer" v-if="!hideFooter">
        <a-button v-if="!hidenCancel" type="primary" shape="round" class="a-button-blue a-button-border" @click="cancel">{{ cancelText || '取 消' }}</a-button>
        <a-button
          v-if="!hidenOk"
          type="primary"
          shape="round"
          class="a-button-blue"
          @click="submit"
          :loading="loading">{{ okText || '确 定' }}</a-button>
      </div>
    </div>
    <a-icon @click="cancel" class="close" type="close" />
  </a-modal>
</template>
<script>
export default {
  name: 'HModal',
  props: {
    config: {
      default: () => {
        return {

        };
      }
    },
    hideFooter: {
      type: Boolean,
      default: false
    },
    loading: {
      type: Boolean,
      default: false
    },
    title: {
      type: String,
      defalut: ''
    },
    okText: {
      type: String,
      defalut: '确 认'
    },
    cancelText: {
      type: String,
      defalut: '取 消'
    },
    showModal: {
      type: Boolean,
      default: false
    },
    hidenCancel: {
      type: Boolean,
      default: false
    },
    hidenOk: {
      type: Boolean,
      default: false
    }
  },
  model: {
    prop: 'showModal',
    event: 'update:showModal'
  },
  data() {
    return {
      show: false
    };
  },
  watch: {
    showModal: {
      handler(val) {
        this.show = val;
      },
      immediate: true
    },
    show(val) {
      this.$emit('update:showModal', val);
    }
  },
  beforeDestroy() {
    this.show = false;
  },
  created() {

  },
  methods: {
    cancel() {
      this.show = false;
      this.$emit('cancel');
    },
    submit() {
      // this.show = false;
      this.$emit('submit');
    }
  }
};
</script>
<style lang="less">
.hmodal {
  padding: 0;
  .ant-modal {
    width: 1280px !important;
    position: relative;
  }

  .close {
    position: absolute;
    right: 30px;
    top: 30px;
    font-size: 24px;
    color: #fff;
    cursor: pointer;
  }

  .ant-modal-content {
    border-radius: 20px;
    overflow: hidden;
  }
  .ant-modal-body {
    padding: 0;
    padding-bottom: 44px;
  }
  .ant-modal-header {
    display: none;
  }
  .h-modal-head {
    height: 120px;
    background: #1F3B8A;
    padding: 30px 44px;
    box-sizing: border-box;
    font-size: 18px;
    font-weight: 500;
    color: #FEFEFF;
  }
  .h-modal-card {
    width: 1200px;
    height: 644px;
    background: #FFFFFF;
    box-shadow: 0px 6px 68px 12px rgba(0,0,0,0.0700);
    border-radius: 30px;
    margin: 0 auto;
    margin-top: -44px;
    padding: 35px 40px;
    box-sizing: border-box;
    position: relative;
  }
  .h-modal-card-cnt {
    // background: #ddd;
    height: 508px;
    overflow-y: auto;
    padding-right: 12px;
    &::-webkit-scrollbar {
      width: 8px;
      height: 1px;
    }
    &::-webkit-scrollbar-thumb {
        border-radius: 10px;
        background: #1F3B8A;
      }
    &::-webkit-scrollbar-track {
      border-radius: 10px;
      background: #EDEDED;
    }
  }
  .h-modal-footer {
    position: absolute;
    bottom: 35px;
    right: 60px;
    .a-button-blue {
      padding: 0 24px;
      height: 38px;
      line-height: 36px;
      margin-right: 15px;
    }
  }
}

</style>
